<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加家长</title>
    <meta name="context-path" th:content="@{/}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/bootstrap.min.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/bootstrap-responsive.min.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/colorpicker.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/datepicker.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/uniform.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/select2.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/matrix-style.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/matrix-media.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/matrix-full.css}"/>
    <link rel="stylesheet" th:href="@{/resources/jquery-easyui/themes/metro/easyui.css}" />
    <link rel="stylesheet" th:href="@{/resources/matrix/font-awesome/css/font-awesome.css}"/>
    <link rel="stylesheet" th:href="@{/resources/valid/css/bootstrapValidator.css}"/>
    <link rel="stylesheet" th:href="@{/resources/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/resources/css/website.css}"/>
</head>
<body class="childbody">
<div class="container-fluid editform_fluid">
    <!--Chart-box-->
    <div class="row-fluid">
        <div class="widget-box">
            <div class="widget-title"><span class="icon"> <i class="icon-align-justify"></i> </span>
                <h5>用户</h5>
            </div>
            <div class="widget-content">
                <form id="detailform" class="form-horizontal">
                    <div class="control-group">
                        <label class="control-label">用户名 :</label>
                        <div class="controls  form-group">
                            <input type="text" name="userName" class="span11 form-control" placeholder="请输入名称">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">家长姓名 :</label>
                        <div class="controls  form-group">
                            <input type="text" name="realName" class="span11 form-control" placeholder="请输入家长姓名">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">手机号码 :</label>
                        <div class="controls  form-group">
                            <input type="text" name="phoneNumber" class="span11 form-control" placeholder="请输入手机号码">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">性别：</label>
                        <div class="controls form-group">
                            <select class="span11 form-control" name="sex">
                                <option value="-1">---请选择---</option>
                                <option th:each="rl : ${sexType}" th:value="${rl.value}"
                                        th:text="${rl.name}"></option>
                            </select>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">身份证号：</label>
                        <div class="controls form-group">
                            <input type="text" name="idcard" class="span11 form-control" placeholder="请输入身份证号">
                        </div>
                    </div>
                    <!--<div class="control-group">
                        <label class="control-label">行政区划：</label>
                        <div class="controls form-group">
                            <select class="span11 form-control" id="county" name="orgId" style="width:91.48936170212765%">
                            </select>
                        </div>
                    </div>-->
                    <!--<div class="control-group">
                        <label class="control-label">角色：</label>
                        <div class="controls form-group">
                            <select class="span11 form-control" name="role">
                                <option th:each="rl : ${roles}" th:value="${rl.id}"
                                        th:text="${rl.roleName}"></option>
                            </select>
                        </div>
                    </div>-->
                    <div class="control-group">
                        <label class="control-label">地址：</label>
                        <div class="controls form-group">
                            <textarea class="span11 form-control" name="address"></textarea>
                        </div>
                    </div>
                    <div class="form-actions">
                        <button id="btnSubmit" type="button" class="btn btn-success">确定</button>
                        <button id="btnClose" type="button" class="btn btn-primary">关闭</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script th:src="@{/resources/js/jquery.min.js}"></script>
<script th:src="@{/resources/js/jquery-migrate-1.2.1.js}"></script>
<script th:src="@{/resources/jquery-easyui/jquery.easyui.min.js}"></script>
<script th:src="@{/resources/layui/layui.all.js}" charset="utf-8"></script>
<script th:src="@{/resources/valid/js/bootstrapValidator.js}"></script>
<script th:src="@{/resources/valid/js/language/zh_CN.js}"></script>
<script th:src="@{/resources/js/website.js}"></script>
<script th:src="@{/resources/js/system.js}"></script>
<script th:src="@{/resources/js/validation_fields.js}"></script>
<script th:src="@{/resources/uploader/AjaxFileUpload/ajaxfileupload.js}"></script>
<script th:src="@{/resources/js/upload.js}"></script>

<script th:inline="javascript">
    var contextRoot = $("meta[name='context-path']").attr("content");
</script>

<script th:inline="javascript">
    /*<![CDATA[*/
    var FormAdd_user = function (form, layer, add, params, formId, validFields) {
        var self = this;
        self.url = params.url;
        self.getData = params.getData;
        self.valid = new FormValidation(formId, validFields);
        self.valid.initValid();
        self.close = function () {
            add.closeDialog();
        };
        self.submit = function () {
            try {
                if (self.valid.isValid()) {
                    layer.load();
                    var data = self.getData();
                    ajaxPost(self.url, data, function (data) {
                        layer.closeAll('loading');
                        parent.layer.msg("操作成功");
                        add.addCompleted();
                    }, function (error) {
                        console.log(error);
                        layer.closeAll('loading');
                        parent.layer.msg("操作失败，已创建该用户！");
                    });
                }
            }
            catch (e) {
                layer.closeAll('loading');
            }
        }
    }
    layui.use(['form', 'layer', 'table'], function () {
        var formAdd = new FormAdd_user(layui.form, layui.layer, parent.add, {
            url: contextRoot + "schoolStudentParent/doAddParent",
            getData: function () {
                return $("#detailform").serializeArray();
            }
        }, "detailform", ValidFields.user.add);
        $("#btnSubmit").bind("click", function (event) {
            formAdd.submit();
        });
        $("#btnClose").bind("click", function (event) {
            formAdd.close();
        });
    });

    /*]]>*/
</script>
</body>
</html>